{
GtkWidget *ancestor;
GdkWindow *window;
+ GList *dest_list = NULL;
g_return_val_if_fail (GTK_IS_WIDGET (src_widget), FALSE);
g_return_val_if_fail (GTK_IS_WIDGET (dest_widget), FALSE);
window = src_widget->window;
while (window != ancestor->window)
{
- gint dx, dy;
-
- gdk_window_get_position (window, &dx, &dy);
-
- src_x += dx;
- src_y += dy;
-
- window = gdk_window_get_parent (window);
+ gdouble dx, dy;
+
+ gdk_window_coords_to_parent (window, src_x, src_y, &dx, &dy);
+
+ src_x = dx;
+ src_y = dy;
+
+ window = gdk_window_get_effective_parent (window);
if (!window) /* Handle GtkHandleBox */
return FALSE;
window = dest_widget->window;
while (window != ancestor->window)
{
- gint dx, dy;
-
- gdk_window_get_position (window, &dx, &dy);
-
- src_x -= dx;
- src_y -= dy;
-
- window = gdk_window_get_parent (window);
-
+ dest_list = g_list_prepend (dest_list, window);
+
+ window = gdk_window_get_effective_parent (window);
+
if (!window) /* Handle GtkHandleBox */
- return FALSE;
+ {
+ g_list_free (dest_list);
+ return FALSE;
+ }
+ }
+
+ while (dest_list)
+ {
+ gdouble dx, dy;
+
+ gdk_window_coords_from_parent (dest_list->data, src_x, src_y, &dx, &dy);
+
+ src_x = dx;
+ src_y = dy;
+
+ dest_list = g_list_remove (dest_list, dest_list->data);
}
/* Translate from window relative to allocation relative */
while (from_ancestor != NULL)
{
- from_ancestor = gdk_window_get_parent (from_ancestor);
+ from_ancestor = gdk_window_get_effective_parent (from_ancestor);
if (from_ancestor == NULL)
break;
from_ancestors = g_list_prepend (from_ancestors, from_ancestor);
while (to_ancestor != NULL)
{
- to_ancestor = gdk_window_get_parent (to_ancestor);
+ to_ancestor = gdk_window_get_effective_parent (to_ancestor);
if (to_ancestor == NULL)
break;
to_ancestors = g_list_prepend (to_ancestors, to_ancestor);
{
if (from_ancestor != NULL)
{
- from_ancestor = gdk_window_get_parent (from_ancestor);
+ from_ancestor = gdk_window_get_effective_parent (from_ancestor);
if (from_ancestor == to_window)
break;
if (from_ancestor)
}
if (to_ancestor != NULL)
{
- to_ancestor = gdk_window_get_parent (to_ancestor);
+ to_ancestor = gdk_window_get_effective_parent (to_ancestor);
if (to_ancestor == from_window)
break;
if (to_ancestor)